import request from '@/utils/request'

/**
 * 获取仪器状态表格
 * @param {*} params 
 */
export function getDevicesState(params) {
  return request({
    url: '/API/DeviceInfo/GetEquipmentStatePage',
    method: 'get',
    params,
    failMsg: true
  })
}

/**
 * 预约仪器
 * @param {String} equipmentCode 仪器编码
 * @param {String} startTime 开始时间
 * @param {String} endTime 结束时间
 */
export function addDeviceAppointment(data) {
  return request({
    url: '/API/DeviceInfo/AddEquipmentAppointment',
    method: 'post',
    data,
    successMsg: true,
    failMsg: true
  })
}

/**
 * 获取仪器下拉框
 */
export function GetEquipmentSelect() {
  return request({
    url: '/API/DeviceInfo/GetEquipmentSelect',
    method: 'get',
    params: {
      pageModel: {
        Search: ['']
      }
    }
  })
}

/**
 * 获取我的预约
 * @param {*} Search 0:仪器编码 
 */
export function getDeviceAppointment(params) {
  return request({
    url: '/API/DeviceInfo/GetEquipmentAppointmentPage',
    method: 'get',
    params,
    failMsg: true
  })
}

/**
 * 取消我的预约
 * @param {*} iautoid 我的预约-主键 
 */
export function cancelAppointment(params) {
  return request({
    url: '/API/DeviceInfo/CallBackEquipmentAppointment',
    method: 'get',
    params,
    successMsg: true,
    failMsg: true
  })
}

/**
 * 添加仪器使用记录
 * @param {*} data 
 */
export function addUserRecord(data) {
  return request({
    url: '/API/DeviceInfo/AddUserRecord',
    method: 'post',
    data,
    successMsg: true,
    failMsg: true
  })
}

/**
 * 获取预约记录
 * @param {*} Search 0:仪器编码 
 */
export function getUserRecordPage(params) {
  return request({
    url: '/API/DeviceInfo/GetUserRecordPage',
    method: 'get',
    params,
    failMsg: true
  })
}

/**
 * 获取仪器列表
 * @param {Object} params
 * @param {Number} params.Rows 每页数量
 * @param {Number} params.Page 页码
 * @param {String} params.SortColumn 排序字段
 * @param {String} params.SortOrder 排序方式
 * @param {Array} params.Search 搜索条件
 * @param {String} params.Search.[0] 仪器类型code
 * @param {String} params.Search.[1] 仪器名称
 */
export function getRecordEquipmentPage(params) {
  return request({
    url: 'API/DeviceInfo/GetRecordEquipmentPage',
    method: 'get',
    params,
    failMsg: true
  })
}

/**
 * 获取仪器使用记录详细信息
 * @param {Object} params
 * @param {String} params.iautoid
 */
export function getRecordById(params) {
  return request({
    url: 'API/DeviceInfo/GetRecordById',
    method: 'get',
    params,
    failMsg: true
  })
}

/**
 * 修改仪器使用记录
 * @param {Object} data 
 */
export function editUserRecord(data) {
  return request({
    url: '/API/DeviceInfo/EditUserRecord',
    method: 'post',
    data,
    successMsg: true,
    failMsg: true
  })
}

/**
 * 删除仪器使用记录
 * @param {Object} params
 * @param {String} params.iautoid
 */
export function deleteUserRecord(params) {
  return request({
    url: '/API/DeviceInfo/DeleteUserRecord',
    method: 'get',
    params,
    successMsg: true,
    failMsg: true
  })
}